package com.realbrand.net.realbrandpay.ui.activity.wallet.bill;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.Toolbar;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.realbrand.net.realbrandpay.R;
import com.realbrand.net.realbrandpay.base.BaseActivity;
import com.realbrand.net.realbrandpay.bean.BillBean;
import com.realbrand.net.realbrandpay.zxing.util.L;
import com.squareup.picasso.Picasso;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by Administrator on 2017/10/19.
 */

public class BillDetailActivity extends BaseActivity {
    @BindView(R.id.billdetail_toolbar)
    Toolbar billdetailToolbar;
    @BindView(R.id.billdetail_tv_account)
    TextView billdetailTvAccount;
    @BindView(R.id.billdetail_tv_money)
    TextView billdetailTvMoney;
    @BindView(R.id.billdetail_tv_DealNumber)
    TextView billdetailTvDealNumber;
    @BindView(R.id.billdetail_tv_time)
    TextView billdetailTvTime;
    @BindView(R.id.billdetail_iv_photo)
    ImageView billdetailIvPhoto;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(getLayoutId());
        ButterKnife.bind(this);
        billdetailToolbar.setTitle("");
        billdetailToolbar.setNavigationIcon(R.drawable.ic_back);
        setSupportActionBar(billdetailToolbar);
        billdetailToolbar.setNavigationOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        //获取数据
        BillBean billBean = (BillBean) getIntent().getExtras().getSerializable("billDetail");
        billdetailTvAccount.setText(billBean.getUserAccount());
        billdetailTvDealNumber.setText(billBean.getDealNumber());
        if (billBean.getDealType().equals("0")||billBean.getDealType().equals("1")||billBean.getDealType().equals("3")) {
            billdetailTvMoney.setText("-" + billBean.getDealMoney());
        } else if (billBean.getDealType().equals("2")) {
            billdetailTvMoney.setText("+" + billBean.getDealMoney());
        }
        billdetailTvTime.setText(billBean.getTradeTime());
        Picasso.with(this).load(billBean.getUserAvatar()).into(billdetailIvPhoto);
        L.d(L.TAG,"账单详情数据"+billBean.toString());
    }

    @Override
    protected int getLayoutId() {
        return R.layout.billdetail_layout;
    }

    @Override
    protected void setOnClick() {

    }

    @Override
    public void onClick(View v) {

    }

}
